package com.johnson.news;

import android.app.Application;

import com.baidu.mapapi.SDKInitializer;
import com.umeng.analytics.MobclickAgent;
import com.umeng.commonsdk.UMConfigure;
import com.youmbe.library.util.MyToast;

import io.reactivex.functions.Consumer;
import io.reactivex.plugins.RxJavaPlugins;

public class MyApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        // 初始化SDK
        UMConfigure.init(this, "561c5f9767e58e48550052d4", "Umeng", UMConfigure.DEVICE_TYPE_PHONE, null);
        // 选用AUTO页面采集模式，不必手动调用MobclickAgent.onResume
        MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.AUTO);

        SDKInitializer.initialize(this);


        RxJavaPlugins.setErrorHandler(new Consumer<Throwable>() {
            @Override
            public void accept(Throwable throwable) throws Exception {
                MyToast.showToast("获取数据失败，请稍后重试。", MyApplication.this);
            }
        });
    }
}
